﻿using KAKA.Domain;
using KAKA.Repository;
using Morus;
using Morus.Infrastructure;
using System;
using System.Collections.Generic;

namespace KAKA.Infrastructure
{
    public class DefaultDictionary : IBootstrapperTask
    {
        private List<Tuple<string, string, string>> _data = new List<Tuple<string, string, string>>();

        public DefaultDictionary()
        {
            _data.Add(new Tuple<string, string, string>("未婚", "1", "marry"));
            _data.Add(new Tuple<string, string, string>("离异", "2", "marry"));
            _data.Add(new Tuple<string, string, string>("丧偶", "3", "marry"));

            _data.Add(new Tuple<string, string, string>("无子女", "1", "child"));
            _data.Add(new Tuple<string, string, string>("有子女,子女在对方", "2", "child"));
            _data.Add(new Tuple<string, string, string>("有子女,子女在己方", "3", "child"));

            _data.Add(new Tuple<string, string, string>("初中", "1", "education"));
            _data.Add(new Tuple<string, string, string>("中专", "2", "education"));
            _data.Add(new Tuple<string, string, string>("高中", "3", "education"));
            _data.Add(new Tuple<string, string, string>("大专", "4", "education"));
            _data.Add(new Tuple<string, string, string>("本科", "5", "education"));
            _data.Add(new Tuple<string, string, string>("双学位", "6", "education"));
            _data.Add(new Tuple<string, string, string>("硕士", "7", "education"));
            _data.Add(new Tuple<string, string, string>("博士", "8", "education"));
            _data.Add(new Tuple<string, string, string>("博士后", "9", "education"));

            _data.Add(new Tuple<string, string, string>("在校学生", "1", "occupation"));
            _data.Add(new Tuple<string, string, string>("计算机/互联网/IT", "2", "occupation"));
            _data.Add(new Tuple<string, string, string>("通信技术", "3", "occupation"));
            _data.Add(new Tuple<string, string, string>("销售", "4", "occupation"));
            _data.Add(new Tuple<string, string, string>("电子/半导体/仪表仪器", "5", "occupation"));
            _data.Add(new Tuple<string, string, string>("市场拓展", "6", "occupation"));
            _data.Add(new Tuple<string, string, string>("公关/商务", "7", "occupation"));
            _data.Add(new Tuple<string, string, string>("采购/贸易", "8", "occupation"));
            _data.Add(new Tuple<string, string, string>("客户服务/技术支持", "9", "occupation"));
            _data.Add(new Tuple<string, string, string>("人力资源/行政/后勤", "10", "occupation"));
            _data.Add(new Tuple<string, string, string>("高级管理", "11", "occupation"));
            _data.Add(new Tuple<string, string, string>("生产/加工/制造", "12", "occupation"));
            _data.Add(new Tuple<string, string, string>("质控/安检", "13", "occupation"));
            _data.Add(new Tuple<string, string, string>("工程机械", "14", "occupation"));
            _data.Add(new Tuple<string, string, string>("技工", "15", "occupation"));
            _data.Add(new Tuple<string, string, string>("财会/审计/统计", "16", "occupation"));
            _data.Add(new Tuple<string, string, string>("金融/证券/投资/保险", "17", "occupation"));
            _data.Add(new Tuple<string, string, string>("房地产/装修/物业", "18", "occupation"));
            _data.Add(new Tuple<string, string, string>("仓储/物流", "19", "occupation"));
            _data.Add(new Tuple<string, string, string>("交通/运输", "20", "occupation"));
            _data.Add(new Tuple<string, string, string>("普通劳动力/家政服务", "21", "occupation"));
            _data.Add(new Tuple<string, string, string>("普通服务行业", "22", "occupation"));
            _data.Add(new Tuple<string, string, string>("航空服务业", "23", "occupation"));
            _data.Add(new Tuple<string, string, string>("教育/培训", "24", "occupation"));
            _data.Add(new Tuple<string, string, string>("咨询/顾问", "25", "occupation"));
            _data.Add(new Tuple<string, string, string>("学术/科研", "26", "occupation"));
            _data.Add(new Tuple<string, string, string>("法律", "27", "occupation"));
            _data.Add(new Tuple<string, string, string>("设计/创意", "28", "occupation"));
            _data.Add(new Tuple<string, string, string>("文学/传媒/影视", "29", "occupation"));
            _data.Add(new Tuple<string, string, string>("餐饮/旅游", "30", "occupation"));
            _data.Add(new Tuple<string, string, string>("化工", "31", "occupation"));
            _data.Add(new Tuple<string, string, string>("能源/地质勘查", "32", "occupation"));
            _data.Add(new Tuple<string, string, string>("医疗/护理", "33", "occupation"));
            _data.Add(new Tuple<string, string, string>("保健/美容", "34", "occupation"));
            _data.Add(new Tuple<string, string, string>("生物/制药/医疗器械", "35", "occupation"));
            _data.Add(new Tuple<string, string, string>("体育工作者", "36", "occupation"));
            _data.Add(new Tuple<string, string, string>("翻译", "37", "occupation"));
            _data.Add(new Tuple<string, string, string>("公务员/国家干部", "38", "occupation"));
            _data.Add(new Tuple<string, string, string>("私营业主", "39", "occupation"));
            _data.Add(new Tuple<string, string, string>("农/林/牧/渔业", "40", "occupation"));
            _data.Add(new Tuple<string, string, string>("警察/其它", "41", "occupation"));
            _data.Add(new Tuple<string, string, string>("自由职业者", "42", "occupation"));
            _data.Add(new Tuple<string, string, string>("其他", "43", "occupation"));

            _data.Add(new Tuple<string, string, string>("1000元以下", "1", "income"));
            _data.Add(new Tuple<string, string, string>("1000-3000 元", "2", "income"));
            _data.Add(new Tuple<string, string, string>("3000-5000 元", "3", "income"));
            _data.Add(new Tuple<string, string, string>("5000-8000 元", "4", "income"));
            _data.Add(new Tuple<string, string, string>("8000-10000 元", "5", "income"));
            _data.Add(new Tuple<string, string, string>("10000-20000 元", "6", "income"));
            _data.Add(new Tuple<string, string, string>("20000元以上", "7", "income"));

            _data.Add(new Tuple<string, string, string>("网络自助交友", "1", "friendType"));
            _data.Add(new Tuple<string, string, string>("活动自助交友", "2", "friendType"));
            _data.Add(new Tuple<string, string, string>("真爱一对一推荐", "3", "friendType"));
            _data.Add(new Tuple<string, string, string>("VIP猎头觅爱", "4", "friendType"));

            _data.Add(new Tuple<string, string, string>("鼠", "1", "zodiac"));
            _data.Add(new Tuple<string, string, string>("牛", "2", "zodiac"));
            _data.Add(new Tuple<string, string, string>("虎", "3", "zodiac"));
            _data.Add(new Tuple<string, string, string>("兔", "4", "zodiac"));
            _data.Add(new Tuple<string, string, string>("龙", "5", "zodiac"));
            _data.Add(new Tuple<string, string, string>("蛇", "6", "zodiac"));
            _data.Add(new Tuple<string, string, string>("马", "7", "zodiac"));
            _data.Add(new Tuple<string, string, string>("羊", "8", "zodiac"));
            _data.Add(new Tuple<string, string, string>("猴", "9", "zodiac"));
            _data.Add(new Tuple<string, string, string>("鸡", "10", "zodiac"));
            _data.Add(new Tuple<string, string, string>("狗", "11", "zodiac"));
            _data.Add(new Tuple<string, string, string>("猪", "12", "zodiac"));

            _data.Add(new Tuple<string, string, string>("O", "1", "blood"));
            _data.Add(new Tuple<string, string, string>("A", "2", "blood"));
            _data.Add(new Tuple<string, string, string>("B", "3", "blood"));
            _data.Add(new Tuple<string, string, string>("AB", "4", "blood"));
            _data.Add(new Tuple<string, string, string>("其他", "5", "blood"));

            _data.Add(new Tuple<string, string, string>("白羊座", "1", "asterism"));
            _data.Add(new Tuple<string, string, string>("金牛座", "2", "asterism"));
            _data.Add(new Tuple<string, string, string>("双子座", "3", "asterism"));
            _data.Add(new Tuple<string, string, string>("巨蟹座", "4", "asterism"));
            _data.Add(new Tuple<string, string, string>("狮子座", "5", "asterism"));
            _data.Add(new Tuple<string, string, string>("处女座", "6", "asterism"));
            _data.Add(new Tuple<string, string, string>("天秤座", "7", "asterism"));
            _data.Add(new Tuple<string, string, string>("天蝎座", "8", "asterism"));
            _data.Add(new Tuple<string, string, string>("射手座", "9", "asterism"));
            _data.Add(new Tuple<string, string, string>("摩羯座", "10", "asterism"));
            _data.Add(new Tuple<string, string, string>("水瓶座", "11", "asterism"));
            _data.Add(new Tuple<string, string, string>("双鱼座", "12", "asterism"));

            _data.Add(new Tuple<string, string, string>("汉族", "1", "nation"));
            _data.Add(new Tuple<string, string, string>("藏族", "2", "nation"));
            _data.Add(new Tuple<string, string, string>("朝鲜族", "3", "nation"));
            _data.Add(new Tuple<string, string, string>("蒙古族", "4", "nation"));
            _data.Add(new Tuple<string, string, string>("回族", "5", "nation"));
            _data.Add(new Tuple<string, string, string>("满族", "6", "nation"));
            _data.Add(new Tuple<string, string, string>("维吾尔族", "7", "nation"));
            _data.Add(new Tuple<string, string, string>("壮族", "8", "nation"));
            _data.Add(new Tuple<string, string, string>("彝族", "9", "nation"));
            _data.Add(new Tuple<string, string, string>("苗族", "10", "nation"));
            _data.Add(new Tuple<string, string, string>("其它民族", "11", "nation"));

            _data.Add(new Tuple<string, string, string>("无宗教信仰", "1", "religion"));
            _data.Add(new Tuple<string, string, string>("大乘佛教显宗", "2", "religion"));
            _data.Add(new Tuple<string, string, string>("大乘佛教密宗", "3", "religion"));
            _data.Add(new Tuple<string, string, string>("小乘佛教", "4", "religion"));
            _data.Add(new Tuple<string, string, string>("道教", "5", "religion"));
            _data.Add(new Tuple<string, string, string>("儒教", "6", "religion"));
            _data.Add(new Tuple<string, string, string>("基督教天主教派", "7", "religion"));
            _data.Add(new Tuple<string, string, string>("基督教东正教派", "8", "religion"));
            _data.Add(new Tuple<string, string, string>("基督教新教派", "9", "religion"));
            _data.Add(new Tuple<string, string, string>("犹太教", "10", "religion"));
            _data.Add(new Tuple<string, string, string>("伊斯兰教什叶派", "11", "religion"));
            _data.Add(new Tuple<string, string, string>("伊斯兰教逊尼派", "12", "religion"));
            _data.Add(new Tuple<string, string, string>("印度教", "13", "religion"));
            _data.Add(new Tuple<string, string, string>("神道教", "14", "religion"));
            _data.Add(new Tuple<string, string, string>("萨满教", "15", "religion"));
            _data.Add(new Tuple<string, string, string>("其它宗教信仰", "16", "religion"));

            _data.Add(new Tuple<string, string, string>("中国", "1", "nationality"));
            _data.Add(new Tuple<string, string, string>("俄罗斯", "2", "nationality"));
            _data.Add(new Tuple<string, string, string>("日本", "3", "nationality"));
            _data.Add(new Tuple<string, string, string>("美国", "4", "nationality"));
            _data.Add(new Tuple<string, string, string>("英国", "5", "nationality"));
            _data.Add(new Tuple<string, string, string>("加拿大", "6", "nationality"));
            _data.Add(new Tuple<string, string, string>("韩国", "7", "nationality"));
            _data.Add(new Tuple<string, string, string>("朝鲜", "8", "nationality"));
            _data.Add(new Tuple<string, string, string>("澳大利亚", "9", "nationality"));
            _data.Add(new Tuple<string, string, string>("法国", "10", "nationality"));
            _data.Add(new Tuple<string, string, string>("新加坡", "11", "nationality"));
            _data.Add(new Tuple<string, string, string>("其他", "12", "nationality"));

            _data.Add(new Tuple<string, string, string>("是", "1", "monotropic"));
            _data.Add(new Tuple<string, string, string>("否", "2", "monotropic"));

            _data.Add(new Tuple<string, string, string>("愿意要孩子", "1", "dink"));
            _data.Add(new Tuple<string, string, string>("不愿意要孩子", "2", "dink"));
            _data.Add(new Tuple<string, string, string>("视情况而定", "3", "dink"));

            _data.Add(new Tuple<string, string, string>("独生子女", "1", "singleton"));
            _data.Add(new Tuple<string, string, string>("老大", "2", "singleton"));
            _data.Add(new Tuple<string, string, string>("老二", "3", "singleton"));
            _data.Add(new Tuple<string, string, string>("老三", "4", "singleton"));
            _data.Add(new Tuple<string, string, string>("老四及更小", "5", "singleton"));
            _data.Add(new Tuple<string, string, string>("老幺", "6", "singleton"));

            _data.Add(new Tuple<string, string, string>("愿意与父母同住", "1", "living"));
            _data.Add(new Tuple<string, string, string>("不愿意与父母同住", "2", "living"));
            _data.Add(new Tuple<string, string, string>("视情况而定", "3", "living"));

            _data.Add(new Tuple<string, string, string>("暂未购车", "1", "car"));
            _data.Add(new Tuple<string, string, string>("已经购车", "2", "car"));

            _data.Add(new Tuple<string, string, string>("暂未购房", "1", "house"));
            _data.Add(new Tuple<string, string, string>("需要时购置", "2", "house"));
            _data.Add(new Tuple<string, string, string>("已购住房", "3", "house"));
            _data.Add(new Tuple<string, string, string>("与人合租", "4", "house"));
            _data.Add(new Tuple<string, string, string>("独自租房", "5", "house"));
            _data.Add(new Tuple<string, string, string>("与父母同住", "6", "house"));
            _data.Add(new Tuple<string, string, string>("住亲朋家", "7", "house"));
            _data.Add(new Tuple<string, string, string>("住单位房", "8", "house"));

            _data.Add(new Tuple<string, string, string>("优秀", "1", "health"));
            _data.Add(new Tuple<string, string, string>("良好", "2", "health"));
            _data.Add(new Tuple<string, string, string>("一般", "3", "health"));
            _data.Add(new Tuple<string, string, string>("略差", "4", "health"));

            _data.Add(new Tuple<string, string, string>("不吸，很反感吸烟", "1", "smoke"));
            _data.Add(new Tuple<string, string, string>("不吸，但不反感", "2", "smoke"));
            _data.Add(new Tuple<string, string, string>("社交时偶尔吸", "3", "smoke"));
            _data.Add(new Tuple<string, string, string>("每周吸几次", "4", "smoke"));
            _data.Add(new Tuple<string, string, string>("每天都吸", "5", "smoke"));
            _data.Add(new Tuple<string, string, string>("有烟瘾", "6", "smoke"));

            _data.Add(new Tuple<string, string, string>("不喝", "1", "drink"));
            _data.Add(new Tuple<string, string, string>("社交需要时喝", "2", "drink"));
            _data.Add(new Tuple<string, string, string>("有兴致时喝", "3", "drink"));
            _data.Add(new Tuple<string, string, string>("每天都离不开酒", "4", "drink"));

            _data.Add(new Tuple<string, string, string>("早睡早起很规律", "1", "life"));
            _data.Add(new Tuple<string, string, string>("经常夜猫子", "2", "life"));
            _data.Add(new Tuple<string, string, string>("总是早起鸟", "3", "life"));
            _data.Add(new Tuple<string, string, string>("偶尔懒散一下", "4", "life"));
            _data.Add(new Tuple<string, string, string>("没有规律", "5", "life"));

            _data.Add(new Tuple<string, string, string>("每天锻炼", "1", "exercise"));
            _data.Add(new Tuple<string, string, string>("每周至少一次", "2", "exercise"));
            _data.Add(new Tuple<string, string, string>("每月几次", "3", "exercise"));
            _data.Add(new Tuple<string, string, string>("没时间锻炼", "4", "exercise"));
            _data.Add(new Tuple<string, string, string>("集中时间锻炼", "5", "exercise"));
            _data.Add(new Tuple<string, string, string>("不喜欢锻炼", "6", "exercise"));

            _data.Add(new Tuple<string, string, string>("计算机（软件、硬件、服务）", "1", "trade"));
            _data.Add(new Tuple<string, string, string>("通信、电信", "2", "trade"));
            _data.Add(new Tuple<string, string, string>("互联网", "3", "trade"));
            _data.Add(new Tuple<string, string, string>("电子（半导体、仪器、自动化）", "4", "trade"));
            _data.Add(new Tuple<string, string, string>("金融服务（会计/审计，银行，保险）", "5", "trade"));
            _data.Add(new Tuple<string, string, string>("金融/投资/证券", "6", "trade"));
            _data.Add(new Tuple<string, string, string>("贸易（进出口,批发,零售）", "7", "trade"));
            _data.Add(new Tuple<string, string, string>("快速消费品（食品,饮料,化妆品）", "8", "trade"));
            _data.Add(new Tuple<string, string, string>("服装/纺织/皮革", "9", "trade"));
            _data.Add(new Tuple<string, string, string>("家具/家电/工艺品/玩具", "10", "trade"));
            _data.Add(new Tuple<string, string, string>("办公用品及设备", "11", "trade"));
            _data.Add(new Tuple<string, string, string>("医疗，医药", "12", "trade"));
            _data.Add(new Tuple<string, string, string>("广告/公关/市场推广/会展", "13", "trade"));
            _data.Add(new Tuple<string, string, string>("影视/媒体/出版/印刷/包装", "14", "trade"));
            _data.Add(new Tuple<string, string, string>("房地产相关", "15", "trade"));
            _data.Add(new Tuple<string, string, string>("家居/室内设计/装潢", "16", "trade"));
            _data.Add(new Tuple<string, string, string>("服务（咨询，人力资源）", "17", "trade"));
            _data.Add(new Tuple<string, string, string>("法律相关", "18", "trade"));
            _data.Add(new Tuple<string, string, string>("教育/培训", "19", "trade"));
            _data.Add(new Tuple<string, string, string>("学术/科研", "20", "trade"));
            _data.Add(new Tuple<string, string, string>("酒店/餐饮业", "21", "trade"));
            _data.Add(new Tuple<string, string, string>("旅游", "22", "trade"));
            _data.Add(new Tuple<string, string, string>("娱乐/休闲/体育", "23", "trade"));
            _data.Add(new Tuple<string, string, string>("美容/保健", "24", "trade"));
            _data.Add(new Tuple<string, string, string>("交通（运输、物流、航天、航空）", "25", "trade"));
            _data.Add(new Tuple<string, string, string>("汽车及零配件", "26", "trade"));
            _data.Add(new Tuple<string, string, string>("农业", "27", "trade"));
            _data.Add(new Tuple<string, string, string>("政府/非盈利机构", "28", "trade"));
            _data.Add(new Tuple<string, string, string>("其他行业", "29", "trade"));

            _data.Add(new Tuple<string, string, string>("计算机类", "1", "major"));
            _data.Add(new Tuple<string, string, string>("电子信息类", "2", "major"));
            _data.Add(new Tuple<string, string, string>("中文类", "3", "major"));
            _data.Add(new Tuple<string, string, string>("外文类", "4", "major"));
            _data.Add(new Tuple<string, string, string>("经济学类", "5", "major"));
            _data.Add(new Tuple<string, string, string>("金融学类", "6", "major"));
            _data.Add(new Tuple<string, string, string>("管理类", "7", "major"));
            _data.Add(new Tuple<string, string, string>("市场营销类", "8", "major"));
            _data.Add(new Tuple<string, string, string>("法学类", "9", "major"));
            _data.Add(new Tuple<string, string, string>("教育类", "10", "major"));
            _data.Add(new Tuple<string, string, string>("社会学类", "11", "major"));
            _data.Add(new Tuple<string, string, string>("历史类", "12", "major"));
            _data.Add(new Tuple<string, string, string>("哲学类", "13", "major"));
            _data.Add(new Tuple<string, string, string>("艺术类", "14", "major"));
            _data.Add(new Tuple<string, string, string>("图书馆类", "15", "major"));
            _data.Add(new Tuple<string, string, string>("情报档案类", "16", "major"));
            _data.Add(new Tuple<string, string, string>("政治类", "17", "major"));
            _data.Add(new Tuple<string, string, string>("数学类", "18", "major"));
            _data.Add(new Tuple<string, string, string>("统计类", "19", "major"));
            _data.Add(new Tuple<string, string, string>("物理类", "20", "major"));
            _data.Add(new Tuple<string, string, string>("化学类", "21", "major"));
            _data.Add(new Tuple<string, string, string>("生物类", "22", "major"));
            _data.Add(new Tuple<string, string, string>("食品类", "23", "major"));
            _data.Add(new Tuple<string, string, string>("医学类", "24", "major"));
            _data.Add(new Tuple<string, string, string>("环境类", "25", "major"));
            _data.Add(new Tuple<string, string, string>("地理类", "26", "major"));
            _data.Add(new Tuple<string, string, string>("建筑类", "27", "major"));
            _data.Add(new Tuple<string, string, string>("测绘类", "28", "major"));
            _data.Add(new Tuple<string, string, string>("电气类", "29", "major"));
            _data.Add(new Tuple<string, string, string>("机械类", "30", "major"));

            _data.Add(new Tuple<string, string, string>("政府机关", "1", "tradeType"));
            _data.Add(new Tuple<string, string, string>("事业单位", "2", "tradeType"));
            _data.Add(new Tuple<string, string, string>("外企企业", "3", "tradeType"));
            _data.Add(new Tuple<string, string, string>("世界500强", "4", "tradeType"));
            _data.Add(new Tuple<string, string, string>("上市公司", "5", "tradeType"));
            _data.Add(new Tuple<string, string, string>("国有企业", "6", "tradeType"));
            _data.Add(new Tuple<string, string, string>("私营企业", "7", "tradeType"));
            _data.Add(new Tuple<string, string, string>("自有公司", "8", "tradeType"));

            _data.Add(new Tuple<string, string, string>("轻松稳定", "1", "workState"));
            _data.Add(new Tuple<string, string, string>("朝九晚五", "2", "workState"));
            _data.Add(new Tuple<string, string, string>("偶尔加班", "3", "workState"));
            _data.Add(new Tuple<string, string, string>("经常加班", "4", "workState"));
            _data.Add(new Tuple<string, string, string>("偶尔出差", "5", "workState"));
            _data.Add(new Tuple<string, string, string>("经常出差", "6", "workState"));
            _data.Add(new Tuple<string, string, string>("经常有应酬", "7", "workState"));
            _data.Add(new Tuple<string, string, string>("工作时间自由", "8", "workState"));

            _data.Add(new Tuple<string, string, string>("福利优越", "1", "incomeDetail"));
            _data.Add(new Tuple<string, string, string>("奖金丰厚", "2", "incomeDetail"));
            _data.Add(new Tuple<string, string, string>("事业稳定上升", "3", "incomeDetail"));
            _data.Add(new Tuple<string, string, string>("事业刚起步", "4", "incomeDetail"));
            _data.Add(new Tuple<string, string, string>("投资高回报", "5", "incomeDetail"));

            _data.Add(new Tuple<string, string, string>("身份证", "X", "idCardType"));
            _data.Add(new Tuple<string, string, string>("军官证", "2", "idCardType"));
            _data.Add(new Tuple<string, string, string>("护照", "3", "idCardType"));
            _data.Add(new Tuple<string, string, string>("其他", "4", "idCardType"));
        }

        public void Execute()
        {
            using (var uow = UnitOfWork.Begin())
            {
                var settingRepository = IoC.Resolve<ISettingRepository>();
                var dictionaryRepository = IoC.Resolve<IDictionaryRepository>();
                var setting = settingRepository.GetByName(Setting.NAME_DICTIONARY_INITIALIZED);
                if (setting == null || Convert.ToBoolean(setting.Value) == false)
                {
                    foreach (var item in _data)
                    {
                        dictionaryRepository.Add(new Dictionary()
                        {
                            Id = Guid.NewGuid(),
                            Name = item.Item1,
                            Value = item.Item2,
                            Type = item.Item3
                        });
                    }

                    if (setting == null)
                    {
                        setting = new Setting()
                        {
                            Id = Guid.NewGuid(),
                            Name = Setting.NAME_DICTIONARY_INITIALIZED,
                            Value = true.ToString()
                        };
                        settingRepository.Add(setting);
                    }
                    else
                    {
                        setting.Value = true.ToString();
                    }
                }

                uow.Commit();
            }
        }
    }
}